package com.arena.model;

import org.json.JSONArray;
import org.json.JSONException;

import com.arena.Static;


public class Questions extends Model {
	String date;
	Question[] question;
	public Questions() {
		super(Static.HOST_QUESTION);		
	}
	@Override
	public void onPostExecute(String result) {	
		super.onPostExecute(result);
		date = (String) this.getField("date");
		JSONArray data = (JSONArray) this.getField("data");
		question = new Question[data.length()];
		for (int i = 0; i < data.length(); i++) {
			try {
				question[i] = new Question(data.getJSONObject(i));
			} catch (JSONException e) {
				e.printStackTrace();
				question[i] = new Question(null);
			}
		}
	}
	/**
	 * Get date
	 * @return
	 */
	public String getDate() {
		return date;
	}
	/**
	 * Get question list
	 * @return
	 */
	public Question[] getQuestionList() {
		return question;
	}

}
